home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / procps.postinst < prev    next >
Text File  |  2009-09-15  |  3KB  |  117 lines

  1. #!/bin/sh
  2. # postinst script for procps
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. # summary of how this script can be called:
  9. #        * <postinst> `configure' <most-recently-configured-version>
  10. #        * <old-postinst> `abort-upgrade' <new version>
  11. #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  12. #          <new-version>
  13. #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  14. #          <failed-install-package> <version> `removing'
  15. #          <conflicting-package> <version>
  16. # for details, see http://www.debian.org/doc/debian-policy/ or
  17. # the debian-policy package
  18. #
  19. # quoting from the policy:
  20. #     Any necessary prompting should almost always be confined to the
  21. #     post-installation script, and should be protected with a conditional
  22. #     so that unnecessary prompting doesn't happen if a package's
  23. #     installation fails and the `postinst' is called with `abort-upgrade',
  24. #     `abort-remove' or `abort-deconfigure'.
  25.  
  26. # Move a conffile without triggering a dpkg question
  27. mv_conffile() {
  28.   OLDCONFFILE="$1"
  29.   NEWCONFFILE="$2"
  30.  
  31.   if [ -e "$OLDCONFFILE" ]; then
  32.     echo "Preserving user changes to $NEWCONFFILE ..."
  33.     mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
  34.     mv -f "$OLDCONFFILE" "$NEWCONFFILE"
  35.   fi
  36. }
  37.  
  38. # update alternative, if it exists
  39. check_alternatives() {
  40.   BINNAME="$1"
  41.   BINPATH="$2"
  42.   MANSEC="$3"
  43.   if [ -e "$BINPATH"/"$BINNAME".procps ] ; then
  44.     update-alternatives --install "$BINPATH"/"$BINNAME" "$BINNAME" \
  45.         "$BINPATH"/"$BINNAME".procps 50 \
  46.         --slave /usr/share/man/man"$MANSEC"/"$BINNAME"."$MANSEC".gz "$BINNAME"."$MANSEC".gz \
  47.         /usr/share/man/man"$MANSEC"/"$BINNAME".procps."$MANSEC".gz
  48.   fi
  49. }
  50. case "$1" in
  51.     configure|abort-remove|abort-deconfigure)
  52.         if [ -e /etc/psdevtab ] ; then
  53.             rm -f /etc/psdevtab
  54.         fi
  55.         if [ -e /etc/psdatabase ] 
  56.         then
  57.             rm -f /etc/psdatabase
  58.         fi
  59.        # Remove old procps init.d script, if it exists Closes: #55137
  60.        if [ -L /etc/rcS.d/S30procps.sh ]
  61.        then
  62.           update-rc.d -f procps.sh remove >/dev/null
  63.        fi
  64.        # and if that didn't work Closes: #92184 (#234306 with -L )
  65.        if [ -L /etc/rcS.d/S30procps.sh ]
  66.        then
  67.            rm -f /etc/rcS.d/S30procps.sh
  68.        fi
  69.        # Remove moved procps.sh file, if it is there
  70.        if dpkg --compare-versions "$2" le "1:3.2.7-3"; then
  71.          mv_conffile "/etc/init.d/procps.sh" "/etc/init.d/procps"
  72.        fi
  73.         
  74.         #
  75.         # Now to do the alternatives for w
  76.         update-alternatives --install /usr/bin/w w /usr/bin/w.procps 50 \
  77.             --slave /usr/share/man/man1/w.1.gz w.1.gz /usr/share/man/man1/w.procps.1.gz
  78.         # Do alternatives for uptime kill vmstat and ps, if required
  79.         check_alternatives "uptime" "/usr/bin" "1"
  80.         check_alternatives "kill" "/usr/bin" "1"
  81.         check_alternatives "vmstat" "/usr/bin" "8"
  82.         check_alternatives "ps" "/bin" "1"
  83.         
  84.     ;;
  85.  
  86.     abort-upgrade)
  87.         # Nothing to do
  88.     ;;
  89.  
  90.     *)
  91.         echo "postinst called with unknown argument \`$1'" >&2
  92.         exit 1
  93.     ;;
  94. esac
  95.  
  96. # dh_installdeb will replace this with shell code automatically
  97. # generated by other debhelper scripts.
  98.  
  99. # Automatically added by dh_installmenu
  100. if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
  101.     update-menus
  102. fi
  103. # End automatically added section
  104. # Automatically added by dh_installinit
  105. update-rc.d -f procps remove >/dev/null || exit $?
  106. # End automatically added section
  107. # Automatically added by dh_makeshlibs
  108. if [ "$1" = "configure" ]; then
  109.     ldconfig
  110. fi
  111. # End automatically added section
  112.  
  113.  
  114. exit 0
  115.  
  116.  
  117.